package com.github.authcloud.server.configure.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;

import java.util.ArrayList;
import java.util.List;

/**
 * @author : zhaoxuan
 * @date : 2021/8/23 15:54
 * @description : AuthCloudProperties
 * @version: 1.0
 */
@ConfigurationProperties(prefix = "auth.cloud")
public class AuthCommonProperties {

    /**
     * 需要拦截的api前缀,配置该项后,不匹配的全不拦截
     */
    private List<String> interApiPrefix = new ArrayList<>();

    /**
     * 不需要拦截的api前缀,配置该项后,不匹配的全部拦截,改配置优先级高于interApiPrefix
     */
    private List<String> notInterApiPrefix = new ArrayList<>();
    /**
     * 拉取接口免登录,角色,权限信息的时间间隔
     * 默认是0, 表示只在项目启动时拉取一次, 之后不再拉取
     * 配置后, 该数值代表启动后间隔多长时间拉取一次
     * 单位:分钟
     */
    private int authRolePermissionFetch = 0;
    /**
     * 启动后延迟多久开始拉取一次
     * 默认是5, 表示只在项目启动时后间隔多长时间开始第一次定时拉取
     * 如果authRolePermissionFetch为0, 则该延时不生效
     * 单位:分钟
     */
    private int fetchDelay = 5;
    /**
     * 开始白名单配置,默认不开启
     */
    private boolean openWhiteList = false;
    /**
     * 需要白名单校验的微服务名称,默认全部校验,配置后,仅校验配置的
     */
    private List<String> needWhiteService = new ArrayList<>();
    /**
     * 开启黑名单配置,默认不开启
     */
    private boolean openBlackList = false;
    /**
     * 不需要黑名单校验的微服务名称,默认全部校验,配置后,配置的服务不校验黑名单
     */
    private List<String> ignoreBlackService = new ArrayList<>();

    public List<String> getInterApiPrefix() {
        return interApiPrefix;
    }

    public void setInterApiPrefix(List<String> interApiPrefix) {
        this.interApiPrefix = interApiPrefix;
    }

    public List<String> getNotInterApiPrefix() {
        return notInterApiPrefix;
    }

    public void setNotInterApiPrefix(List<String> notInterApiPrefix) {
        this.notInterApiPrefix = notInterApiPrefix;
    }

    public int getAuthRolePermissionFetch() {
        return authRolePermissionFetch;
    }

    public void setAuthRolePermissionFetch(int authRolePermissionFetch) {
        this.authRolePermissionFetch = authRolePermissionFetch;
    }

    public int getFetchDelay() {
        return fetchDelay;
    }

    public void setFetchDelay(int fetchDelay) {
        this.fetchDelay = fetchDelay;
    }

    public boolean isOpenWhiteList() {
        return openWhiteList;
    }

    public void setOpenWhiteList(boolean openWhiteList) {
        this.openWhiteList = openWhiteList;
    }

    public boolean isOpenBlackList() {
        return openBlackList;
    }

    public void setOpenBlackList(boolean openBlackList) {
        this.openBlackList = openBlackList;
    }

    public List<String> getIgnoreBlackService() {
        return ignoreBlackService;
    }

    public void setIgnoreBlackService(List<String> ignoreBlackService) {
        this.ignoreBlackService = ignoreBlackService;
    }

    public List<String> getNeedWhiteService() {
        return needWhiteService;
    }

    public void setNeedWhiteService(List<String> needWhiteService) {
        this.needWhiteService = needWhiteService;
    }
}